package com.fh.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author zhaolh
 * @title: User
 * @projectName ssm-demo
 * @description: TODO
 * @date 2021/11/2 11:19
 */
public class User {

    private Integer id;
    private String username;
    private Integer sex;
    private String hobby;
    @DateTimeFormat(pattern = "yyyy-MM-dd")  // 前台往后台添加
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") // 后台向前台展示
    private Date birthday;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", sex=" + sex +
                ", hobby='" + hobby + '\'' +
                ", birthday=" + birthday +
                '}';
    }

    public User() {
    }

    public User(Integer id, String username, Integer sex, String hobby, Date birthday) {
        this.id = id;
        this.username = username;
        this.sex = sex;
        this.hobby = hobby;
        this.birthday = birthday;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
